# coding:utf8
import findspark
findspark.init()
from pyhive import hive

if __name__ == '__main__':
    # 获取到Hive(Spark ThriftServer的链接)
    conn = hive.Connection(host="bigdata", port=10000, username="root")

    # 获取一个游标对象
    cursor = conn.cursor()

    # 执行SQL
    cursor.execute("select * from dws_gmall2022.dws_visitor_action_daycount where dt='2022-08-24'")

    # 通过fetchall API 获得返回值
    result = cursor.fetchall()

    print(result)
